<template>
  <div id="MultiThrod">
    <el-button @click="workerTest">workerTest</el-button>
  </div>
</template>

<script>
// import { mapState, mapMutations, mapActions } from 'vuex'
// import validMixins from '@/mixins/validMixins.js'
import Worker from './my.worker'
export default {
  name: 'MultiThrod',
  components: {
    // TablesGZCJ,
  },
  // mixins: [validMixins],
  props: {
    // treeData: Array,
  },
  // mixins: [validMixins],
  data() {
    return {
      levelList: null
    }
  },
  computed: {
    // ...mapState('user', ['token', 'userInfo'])
  },
  watch: {
    // 'cmAddForm.enginePlatform': function(val) {
    //   console.log('enginePlatformval', val)
    //   if (val) {
    //     this.emissionOptionReq()
    //   }
    // }
  },
  created() {

  },
  mounted() {
//     var channel=new MessageChannel();
//     let book={id:1}
// //默认：book将对序列化的方式进行发送
// //port1发送时，由port2时行接收
//     channel.port1.postMessage(book);
//
// //默认：event.data,是book对象的"深克隆对象"
//     channel.port2.onmessage=function (event) {
//       console.log(event.data.id) //show 1
//     }




  },
  methods: {
    workerTest(){
      const worker = new Worker()
      worker.postMessage(params)
      worker.onmessage = function (e) {
        console.log(333, e.data)
        worker.terminate()
      }
      worker.onerror = function (error) {
        console.log(444, error, error.message)
        worker.terminate()
      }
    },
    // ...mapActions('user', ['closeSideBar']),
    // ...mapMutations('user', ['CHAGE_TOKEN']),
    functionTest() {}
  }
}
</script>

<style lang="scss">
  #MultiThrod {

  }
</style>

